import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:twitter_app/common/components/app_drawer_tile.dart';
import 'package:twitter_app/common/routers/index.dart';

class AppDrawer extends StatelessWidget {
  const AppDrawer({super.key});

  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: SafeArea(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20),
          child: Column(
            children: [
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 50),
                child: Icon(
                  Icons.person,
                  size: 72,
                  color: Theme.of(context).colorScheme.primary,
                ),
              ),
              // 分隔线
              Divider(
                color: Theme.of(context).colorScheme.secondary,
              ),
              const SizedBox(
                height: 10,
              ),
              AppDrawerTile(
                onTap: () {
                  Get.back();
                },
                title: '首页',
                icon: Icons.home,
              ),
              AppDrawerTile(
                onTap: () {
                  Get.toNamed(RouteNames.search);
                },
                title: '搜索',
                icon: Icons.search,
              ),
              AppDrawerTile(
                onTap: () {
                  Get.toNamed(RouteNames.settings);
                },
                title: '设置',
                icon: Icons.settings,
              ),
              AppDrawerTile(
                onTap: () {
                  Get.toNamed(RouteNames.logout);
                },
                title: '退出',
                icon: Icons.logout,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
